#pragma once
#include <chrono>
class MyTimer {
	long long secTimeout = 3600;//默认运行3600s
	std::chrono::steady_clock::time_point s_time, e_time;
public:
	MyTimer() {}
	MyTimer(long long runTime)
	{
		secTimeout = runTime;
	}
	void setTime(long long runTime)
	{
		secTimeout = runTime;
	}
	void startTime()
	{

		s_time = std::chrono::steady_clock::now();
		e_time = s_time + std::chrono::seconds(secTimeout);
	}
	bool isTimeout()
	{
		return e_time < std::chrono::steady_clock::now();
	}
	double getTime()
	{
		double _time;
		auto afterTime = std::chrono::steady_clock::now();
		_time = std::chrono::duration<double>(afterTime - s_time).count();
		return _time;
	}

};